package com.i5.distributedlock.annotation;

import com.i5.distributedlock.enumeration.InterProcess;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.concurrent.TimeUnit;

/**
 * zookeeper分布式锁的注解
 *
 *
 * @author mc0710
 */
@Retention(value = RetentionPolicy.RUNTIME)
@Target(value = { ElementType.METHOD })
public @interface ZLock {

	/**
	 * 锁类型
	 * 
	 * @return
	 */
	InterProcess interProcess() default InterProcess.MUTEX;

	/**
	 * 等待锁时间，默认单位：秒
	 * 
	 * @return
	 */
	long waitTime() default 1;

	/**
	 * 锁时长单位
	 * 
	 * @return
	 */
	TimeUnit timeUnit() default TimeUnit.SECONDS;
}
